#ifndef MAINFORM_H
#define MAINFORM_H
#include"ui_mainform.h"
#include"download.h"
#include <QApplication>
#include<QtCore>
#include <QMainWindow>
#include<QSystemTrayIcon>
#include<QCloseEvent>
#include<QEvent>
#include<QSqlDatabase>
#include<QSqlQuery>
#include"configure.h"
#include "db.h"
#include "TableWidget.h"
#include<QtGlobal>
#include<QMenu>
#include<QAction>
#include<QStringList>
#include<QSqlDatabase>
#include<QSqlQuery>
#include<QSqlRecord>
#include<QDir>
#include<QTableWidgetItem>
#include"public.h"
#include<QThread>
#include<QList>
#include<QMap>

const int ColumnWidth =200;
class MainForm :public QMainWindow
{
    Q_OBJECT
    public:
        MainForm(QWidget* parent=NULL);
        ~MainForm(void);
        void show();
    public slots:
        void GetDownloadInfo(const QString& file,const int& Rate,const int& percent,const QString& path);
        void GetConfigChange(const confinfo& confdata);
        void ShowTable(int index);
protected:
        void closeEvent(QCloseEvent *event);
        void changeEvent ( QEvent * event );

private:
        QSystemTrayIcon* trayicon;
        Ui::MainWindow ui;
        DownloadControl* downloadcontrol;
        QSqlDatabase db;
        Configure* conf;
        confinfo confdata;
        TableWidget* todaytable;
        TableWidget* historytable;
        QMap<QString,QObject*> processmap;
        void ShowHistoryTable(void);
        void CreateDownloadfile(void);
    private  slots:
              void ShowTodayTable(void);
              void StartFile(void);
};
#endif // MAINFORM_H
